﻿using System;
using System.Data;

public class jsh_user
{
public Int64 id{get;set;}
public string username{get;set;}
public string displayname{get;set;}
public string password{get;set;}
public string sex{get;set;}
public string nation{get;set;}
public string zjlx{get;set;}
public string zjhm{get;set;}
public string type{get;set;}
public string czqx{get;set;}
public string telephone{get;set;}
public string mobile{get;set;}
public string addr{get;set;}
public byte[] photo{get;set;}

private string InsertSql = "insert into jsh_user([id],[username],[displayname],[password],[sex],[nation],[zjlx],[zjhm],[type],[czqx],[telephone],[mobile],[addr],[photo]) values(@id,@username,@displayname,@password,@sex,@nation,@zjlx,@zjhm,@type,@czqx,@telephone,@mobile,@addr,@photo)";
private string UpdateSql = "UPDATE jsh_user SET [id]=@id,[username]=@username,[displayname]=@displayname,[password]=@password,[sex]=@sex,[nation]=@nation,[zjlx]=@zjlx,[zjhm]=@zjhm,[type]=@type,[czqx]=@czqx,[telephone]=@telephone,[mobile]=@mobile,[addr]=@addr,[photo]=@photo";

private bool _tranByConstructFlag = false;
public bool TranByConstructFlag{get{ return _tranByConstructFlag; } set{ _tranByConstructFlag = value; }}
public jsh_user(DataRow dataRow){
if(dataRow != null){
try{
this.id = dataRow["id"] is DBNull ? 0 : Convert.ToInt64(dataRow["id"]);
this.username = dataRow["username"] is DBNull ? string.Empty : Convert.ToString(dataRow["username"]);
this.displayname = dataRow["displayname"] is DBNull ? string.Empty : Convert.ToString(dataRow["displayname"]);
this.password = dataRow["password"] is DBNull ? string.Empty : Convert.ToString(dataRow["password"]);
this.sex = dataRow["sex"] is DBNull ? string.Empty : Convert.ToString(dataRow["sex"]);
this.nation = dataRow["nation"] is DBNull ? string.Empty : Convert.ToString(dataRow["nation"]);
this.zjlx = dataRow["zjlx"] is DBNull ? string.Empty : Convert.ToString(dataRow["zjlx"]);
this.zjhm = dataRow["zjhm"] is DBNull ? string.Empty : Convert.ToString(dataRow["zjhm"]);
this.type = dataRow["type"] is DBNull ? string.Empty : Convert.ToString(dataRow["type"]);
this.czqx = dataRow["czqx"] is DBNull ? string.Empty : Convert.ToString(dataRow["czqx"]);
this.telephone = dataRow["telephone"] is DBNull ? string.Empty : Convert.ToString(dataRow["telephone"]);
this.mobile = dataRow["mobile"] is DBNull ? string.Empty : Convert.ToString(dataRow["mobile"]);
this.addr = dataRow["addr"] is DBNull ? string.Empty : Convert.ToString(dataRow["addr"]);
this.photo = dataRow["photo"] is DBNull ? new byte[0] : (byte[])dataRow["photo"];
this.TranByConstructFlag = true;
}catch(Exception){ this.TranByConstructFlag = false; }
}
}
public jsh_user(){}
}
